﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using LispInterpretor;

namespace UnitTests
{
    [TestClass]
    public class TestEquals
    {
        [TestMethod]
        public void TestWithMisMatchedArguments()
        {
            Assert.AreEqual(false, Evaluator.Eval("(= 3 True)"));
        }

        [TestMethod]
        [ExpectedException(typeof(InvalidProgramException))]
        public void TestEqualsWithOneArgument()
        {
            Evaluator.Eval("(= 3)");
        }

        [TestMethod]
        public void TestTrueIntegerComparison()
        {
            Assert.AreEqual(true, Evaluator.Eval("(= 3 3)"));
        }

        [TestMethod]
        public void TestFalseIntegerComparison()
        {
            Assert.AreEqual(false, Evaluator.Eval("(= 2 3)"));
        }

        [TestMethod]
        public void TestTrueBoolComparison()
        {
            Assert.AreEqual(true, Evaluator.Eval("(= True True)"));
        }

        [TestMethod]
        public void TestFalseBoolComparison()
        {
            Assert.AreEqual(false, Evaluator.Eval("(= False True)"));
        }

        [TestMethod]
        public void TestTrueStringComparison()
        {
            Assert.AreEqual(true, Evaluator.Eval("(= \"Test\" \"Test\")"));
        }

        [TestMethod]
        public void TestFalseStringComparison()
        {
            Assert.AreEqual(false, Evaluator.Eval("(= \"Test\" \"Test1\")"));
        }

        [TestMethod]
        public void TestFalseListComparison()
        {
            Assert.AreEqual(false, Evaluator.Eval("(= (1 2 3) (3 2 1))"));
        }

        [TestMethod]
        public void TestTrueListComparison()
        {
            Assert.AreEqual(true, Evaluator.Eval("(= (1 2 3) (1 2 3))"));
        }

        [TestMethod]
        public void TestTrueListComparisonOfVaryingTypes()
        {
            Assert.AreEqual(true, Evaluator.Eval("(= (1 \"Test\" true) (1 \"Test\" true))"));
        }

        [TestMethod]
        public void TestUnEqualListComparison()
        {
            Assert.AreEqual(false, Evaluator.Eval("(= (1 2) (1 2 3))"));
        }
    }
}
